MaxVal = 100000

n = int(input())
a = [0] * n
for i in range(n):
    a[i] = int(input())

ans = 0

# divisors[i] - all divisors of i
divisors = [[] for i in range(MaxVal + 1)]
for i in range(1, MaxVal + 1):
    for j in range(i, MaxVal + 1, i):
        divisors[j].append(i)

# c[d] - number of elements = d
c = [0] * (MaxVal + 1)

# f[d] - number of pairs with first element = d
f = [0] * (MaxVal + 1)

for i in range(n - 1, -1, -1):
    f_a_i = f[a[i]]
    for d in divisors[a[i]]:
        ans += f[d]
        f_a_i += c[d]
    f[a[i]] = f_a_i
    c[a[i]] += 1

print(ans)
